<template>
  <div class="login-container flx-center">
    <div class="login-box">
      <!-- <SwitchDark class="dark" /> -->
      <div class="login-left">
        <span :style="{ fontSize: ft + 'px' }">{{ strGongSiMingCheng }}</span>
      </div>
      <div class="login-form">
        <div class="titlehead" :style="{ marginTop: mt + 'px' }">
          <h2 class="logo-text">体检管理系统</h2>
        </div>
        <LoginForm />
      </div>
    </div>
    <div class="company">Copyright C 2006-2024 MuYang Corporation, All Rights Reserved</div>
  </div>
</template>

<script setup lang="ts" name="login">
import { onMounted, ref } from "vue";
import { GetInitializeport } from "@/api/modules/user";
import { loginStore } from "@/stores/login/index";

const initloginStore = loginStore();
const ft = ref();
const mt = ref();
import LoginForm from "./components/LoginForm.vue";
// import SwitchDark from "@/components/SwitchDark/index.vue";
const strGongSiMingCheng = ref<string>();

const init = () => {
  GetInitializeport().then((res: any) => {
    console.log(res);
    if (res.Success == 0) {
      initloginStore.strYiYuanMingChengchange(res.Data.strYiYuanMingCheng);
      initloginStore.XiTongnameChange(res.Data.listXiTongMingCheng);

      initloginStore.setDatabaseName(res.Data.databaseName);
      initloginStore.setServerIpAddress(res.Data.serverIpAddress);
      initloginStore.setStrGongSiMingCheng(res.Data.strGongSiMingCheng);
      initloginStore.setStripaddress(res.Data.stripaddress);

      strGongSiMingCheng.value = res.Data.strGongSiMingCheng;
    }
  });
};

onMounted(() => {
  if (window.innerWidth >= 1920) {
    ft.value = "50";
    mt.value = "100";
  } else if (window.innerWidth < 1920) {
    ft.value = "30";
  }
  init();
});
</script>

<style scoped lang="scss">
@import "./index.scss";
</style>
